Connectome can be used to identify and visualize major perturbed cell-cell communication pathways in A/B comparisons of complex tissue systems.
library(Seurat)
library(SeuratData)
library(connectome)
library(ggplot2)
library(cowplot)
library(ComplexHeatmap)
To demonstrate differential connectomics using Connectome, we will use the interferon-stimulated vs. control PBMC data distributed by SeuratData:
InstallData('ifnb')
data('ifnb')
table(Idents(ifnb))
#>
#> IMMUNE_CTRL IMMUNE_STIM
#> 6548 7451
Idents(ifnb) <- ifnb[['seurat_annotations']]
table(Idents(ifnb))
#>
#> CD14 Mono CD4 Naive T CD4 Memory T CD16 Mono B
#> 4362 2504 1762 1044 978
#> CD8 T T activated NK DC B Activated
#> 814 633 619 472 388
#> Mk pDC Eryth
#> 236 132 55
Connectomic networks must first be calculated for each tissue system separately. To do so:
# First identify ligands and receptors which have mapped in the dataset:
connectome.genes <- union(connectome::ncomms8866_human$Ligand.ApprovedSymbol,connectome::ncomms8866_human$Receptor.ApprovedSymbol)
genes <- connectome.genes[connectome.genes %in% rownames(ifnb)]
# Split the object by condition:
ifnb.list <- SplitObject(ifnb,split.by = 'stim')
# Normalize, Scale, and create Connectome:
ifnb.con.list <- list()
for (i in 1:length(ifnb.list)){
ifnb.list[[i]] <- NormalizeData(ifnb.list[[i]])
ifnb.list[[i]] <- ScaleData(ifnb.list[[i]],features = rownames(ifnb.list[[i]]))
ifnb.con.list[[i]] <- CreateConnectome(ifnb.list[[i]],species = 'human',p.values = F)
}
names(ifnb.con.list) <- names(ifnb.list)
diff <- DifferentialConnectome(ifnb.con.list[[1]],ifnb.con.list[[2]])
DifferentialScoringPlot(diff,min.score = 2,min.pct = 0.1,infinity.to.max = T)
Edgeweights here are the perturbation score, which is always positive, by design. However, in conenctomic data, there are 4 separate classes of perturbations, as both the ligand and the receptor can either be differentially increased or decreased. Here, we investigate each type of perturbation in turn:
diff.up.up <- subset(diff,ligand.norm.lfc > 0 & recept.norm.lfc > 0 )
CircosDiff(diff.up.up,min.score = 2,min.pct = 0.1,lab.cex = 0.4)
diff.up.down <- subset(diff,ligand.norm.lfc > 0 & recept.norm.lfc < 0 )
CircosDiff(diff.up.down,min.score = 2,min.pct = 0.1,lab.cex = 0.4)
diff.down.up <- subset(diff,ligand.norm.lfc < 0 & recept.norm.lfc > 0 )
CircosDiff(diff.down.up,min.score = 2,min.pct = 0.1,lab.cex = 0.4)
diff.down.down <- subset(diff,ligand.norm.lfc < 0 & recept.norm.lfc < 0 )
CircosDiff(diff.down.down,min.score = 2,min.pct = 0.1,lab.cex = 0.4)
We can also look at perturbed edges within just a specific community of cells:
CircosDiff(diff,min.score = 2,min.pct = 0.1,lab.cex = 0.4,
sources.include = c('pDC','CD8 T','B'),targets.include = c('CD16 Mono','CD14 Mono'))
CircosDiff(diff,min.score = 2,min.pct = 0.1,lab.cex = 0.4,
targets.include = c('CD14 Mono'))
CircosDiff(diff,min.pct = 0.1,lab.cex = 0.4,
targets.include = c('CD14 Mono'),features = c('CCR5'))